<template>
  <van-tabbar v-model="footerindex">
    <van-tabbar-item icon="video-o" to="/home">电影</van-tabbar-item>
    <van-tabbar-item icon="tv-o" to="/video">视频</van-tabbar-item>
    <van-tabbar-item icon="cashier-o" to="/svideo">小视频</van-tabbar-item>
    <van-tabbar-item icon="coupon-o" to="/pageofshow">演出</van-tabbar-item>
    <van-tabbar-item icon="friends-o" to="/mine">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script>
import routes from '@/router/routes'
export default {
  name: 'ABPFooter',
  data () {
    return {
      footerindex: 0
    }
  },
  created () {
    // console.log('/' + this.$route.path.split('/')[1])
    // console.log(this.tabbars)
    // console.log(routes)
    this.tabbars.forEach((tab, index) => {
      if (tab.path === '/' + this.$route.path.split('/')[1]) {
        this.footerindex = index
      }
    })
  },
  computed: {
    tabbars () {
      return routes.filter(route => route.meta.isTabbar)
    }
  }
}
</script>

<style>

</style>
